﻿package mortal.game.view.common.alertwins
{
    import com.mui.controls.*;
    import flash.display.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.component.window.*;
    import mortal.game.view.common.*;

    public class CheckBoxWin extends CustomAlertWin
    {
        protected var checkBox:GCheckBox;

        public function CheckBoxWin(param1:Number, param2:Number)
        {
            super(param1, param2);
            return;
        }// end function

        override protected function createChildren() : void
        {
            super.createChildren();
            this.checkBox = UIFactory.checkBox(Alert.checkBoxLabel, 0, 0, 120, 22);
            this.checkBox.textField.textColor = 65280;
            return;
        }// end function

        override protected function layoutAllUI() : void
        {
            super.layoutAllUI();
            prompt.addChild(this.checkBox);
            this.checkBox.x = 35;
            this.checkBox.y = myHeight - 20;
            return;
        }// end function

        override protected function layoutBtnSp() : void
        {
            btnSp.x = 14 + (myWidth - (Alert.buttonWidth + Alert.buttonGap) * allButtons.length + Alert.buttonGap) / 2;
            btnSp.y = myHeight - 45;
            return;
        }// end function

        override protected function createPromptBoarder() : Sprite
        {
            var _loc_1:* = new BgWindow();
            (_loc_1 as BgWindow).isForbidenDrag = true;
            (_loc_1 as BgWindow).closeBtn.visible = false;
            return _loc_1;
        }// end function

        override protected function buttonClickHandler(event:MouseEvent) : void
        {
            if (closeHandler != null)
            {
                if (event.target && event.target.name)
                {
                    if (extendObj != null)
                    {
                        closeHandler(Number(event.target.name.substr(4)), this.checkBox != null ? (this.checkBox.selected) : (false), extendObj);
                    }
                    else
                    {
                        closeHandler(Number(event.target.name.substr(4)), this.checkBox != null ? (this.checkBox.selected) : (false));
                    }
                }
            }
            DisplayUtil.removeMe(this);
            return;
        }// end function

        override protected function onCloseBtnClickHandler(event:Event) : void
        {
            var _loc_2:Array = null;
            var _loc_3:int = 0;
            if (closeHandler != null)
            {
                _loc_2 = getButtonFlagsList();
                _loc_3 = Alert.CANCEL;
                if (_loc_2[1] == 1)
                {
                    _loc_3 = Alert.NO;
                }
                if (_loc_2[3] == 1)
                {
                    _loc_3 = Alert.CANCEL;
                }
                if (extendObj != null)
                {
                    closeHandler(_loc_3, extendObj, this.checkBox.selected, true);
                }
                else
                {
                    closeHandler(_loc_3, this.checkBox.selected, true);
                }
                closeHandler = null;
            }
            super.onCloseBtnClickHandler(event);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            return;
        }// end function

    }
}
